package com.rs.game.player.dialogues.impl;

import com.rs.Settings;
import com.rs.game.World;
import com.rs.game.WorldTile;
import com.rs.game.player.Player;
import com.rs.game.player.content.Magic;
import com.rs.game.player.dialogues.Dialogue;

public class JModTable extends Dialogue {
	
	/**
	 * This dialogue is sent upon the player clicking on object id: 26807.
	 * @author Swirl
	 */

	@Override
	public void start() {
		if (player.getRights() >= 2) {
			sendOptionsDialogue("Select an Option", "Summon P-Mods", "Make Moderator", "Close Meeting");
		} else {
			player.getPackets().sendGameMessage("You must be an admininistrator to use this table.");
		}
	}

	@Override
	public void run(int interfaceId, int componentId) {
		switch (stage) {
		case -1:
			switch (componentId) {
			case OPTION_1:
				for (Player staff : World.getPlayers()) {
					if (staff.getRights() == 0 || staff.getRights() == 2) {
						continue;
					}
					Magic.sendNormalTeleportSpell(staff, 0, 0, new WorldTile(2847, 5150, 0));
					staff.getPackets().sendGameMessage("You've been teleported for a staff meeting by " + player.getDisplayName());
				}
				stage = 1;
				break;
			case OPTION_2:
				break;
			case OPTION_3:
				for (Player staff : World.getPlayers()) {
					if (staff.getRights() == 0) {
						continue;
					}
					Magic.sendNormalTeleportSpell(staff, 0, 0, Settings.RESPAWN_PLAYER_LOCATION);
					staff.getPackets().sendGameMessage("The meeting is over.");
				}
				stage = 1;
				break;
			}
		case 1:
			end();
		}
	}

	@Override
	public void finish() {
		// TODO Auto-generated method stub
		
	}

}
